<?php

namespace app\enum;

enum StatusCode: int
{
    case SUCCESS = 1;
    case FAIL = 0;

    case NOT_FOUND = 404;

    case NO_LOGIN = 200400;
    case NO_AUTH = 200401;

    case PARAM_ERROR = 400400;

    public function msg(): string
    {
        return match($this) {
            self::SUCCESS  => '操作成功',
            self::FAIL     => '操作失败',
            self::NO_LOGIN => '未登录',
            self::NO_AUTH  => '登录失败',
            self::PARAM_ERROR => '参数有误',
            self::NOT_FOUND => '404 Not Found!',
        };
    }
}
